<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">  
<title>专利协同服务网络平台</title>
<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
	function getSynergy(uri){
			layer.open({content:uri,type:2,area:['1200px','600px']});
		}


	</script>
<style type="text/css">
.imgtable td{
	height:50px;
}
#checkbook{
	font-size:15px;
	color:#5A98DE;
	font-weight:bold;
}
</style>
</head>
<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
		<li><a href="#">首页</a></li>
		<li><a href="#">待接单专利</a></li>
		</ul>
    </div>
    
    <div class="rightinfo">
    	<form action="${pageContext.request.contextPath}${pageModel.url}" method="post">
	    	<ul class="seachform" style="margin-left: 20px;">
			    <li><label>专利名称</label><input  name="name" type="text" value="${name}" class="scinput" style="width:500px;margin-top:3px;"/></li>
			    <li><label>&nbsp;</label><input type="submit" class="scbtn"  value="查询"/></li>
		    </ul>
	    </form>
		<table class="imgtable">	
			<thead>
				<tr>
				<th>专利ID</th>
					<th>专利名称</th>
					<th>所属学科</th>
					<th>专利协同申请书</th>
					<th>专利交底书</th>
					<th>申请人</th>
					<th>专利状态</th>
					<th>申请时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			<c:forEach items="${pageModel.list}" var="patent">
				<tr>
				<td>${patent.num}</td>
	
					<td>${patent.name}</td>
					<c:forEach items="${patentSubjectsChars}" var="subjectsChars" >
						<c:if test="${subjectsChars.key == patent.id}">
							<td>${subjectsChars.value}</td>
						</c:if>
					</c:forEach>
					<td><a style="cursor:pointer"  onclick="getSynergy('${pageContext.request.contextPath}/scienceExpert/listPatentSynergyByPatent.do?patentId=${patent.id}&location=待接单专利')" id="checkbook">[查看]</a></td>
					<td>------</td>
					<td>${patent.researcher.userName}</td>
					<c:forEach items="${dicPatentStates}" var="dicPatentState">
						<c:if test="${dicPatentState.typeCode == patent.patentState}">&nbsp;&nbsp;&nbsp;&nbsp;
							<td>${dicPatentState.description}</td>
							<td>${patent.createTime}</td>
							<c:choose>
								<c:when test="${dicPatentState.description == '待接单'}">
									<td><a href="javascript:receviceApply('${patent.id}');" id="checkbook">接单</a></td>
								</c:when>
								<c:when test="${dicPatentState.description == '已接单'}">
									<td><a href="#" id="checkbook">结项</a></td>
								</c:when>
								<c:otherwise>
									<td><a href="#" id="checkbook">--</a></td>
								</c:otherwise>
							</c:choose>
						</c:if>
					</c:forEach>
				</tr>
			</c:forEach>
			</tbody>	
		</table>
		<!-- 
			引入分页菜单
		 -->
		<%@include file="../../common/page.jsp"%>
    </div>
<script type="text/javascript">
	$('.imgtable tbody tr:odd').addClass('odd');
	function receviceApply(patentId){
		$.ajax({
			type:"POST",
			dataType:"text",
			data:{"patentId":patentId},
			url:"${pageContext.request.contextPath}/scienceExpert/receiveApply.do",
			success:function(data){
				if(data == "success"){
					layer.msg("接单成功！");
					setTimeout(function() { 
						window.location.href="${pageContext.request.contextPath}/scienceExpert/listAllPatentByParams.do"
					},300);
				} else {
					layer.msg("接单失败,请重试。");
				}
					
			}
		
		});
	}
</script>
</body>
</html>